#include<bits/stdc++.h>
using namespace std;
const int N=5e5+4;
int m,n,d[N],s[N],c[N],res;
struct name{
    double f;
    int t;
    int id;
}a[N];
bool cmp(name a,name b){
    return a.f<b.f;
}
struct query{
    int op,x,id;
}q[N];
#define ls(x) (x<<1)
#define rs(x) (x<<1|1)
struct tree{
    double dis;
    int v;
    tree operator +(tree a){
        return {dis+a.dis,v+a.v};
    }
}t[N<<2];
void update(int x,int st,int ed,int p,int k){
    if(st==ed){
        // cerr<<x<<" "<<st<<" "<<ed<<" "<<k<<"\n";
        t[x].v+=k;
        t[x].dis=t[x].v*a[st].f;
        // if(st==6) cerr<<t[x].dis<<" "<<t[x].v<<" "<<a[d[st]].f<<"!!!\n";
        return;
    }
    int mid=(st+ed)>>1;
    if(p<=mid) update(ls(x),st,mid,p,k);
    else update(rs(x),mid+1,ed,p,k);
    t[x]=t[ls(x)]+t[rs(x)];
} 
tree query(int x,int st,int ed,int l,int r){
    if(l<=st&&ed<=r)
        return t[x];
    int mid=(st+ed)>>1;
    tree ans={0,0};
    if(l<=mid) ans=ans+query(ls(x),st,mid,l,r);
    if(r>mid) ans=ans+query(rs(x),mid+1,ed,l,r);
    return ans;
}
int get(int x,int st,int ed,int k){
    if(st==ed) return st;
    int mid=(st+ed)>>1;
    // cerr<<x<<" "<<ls(x)<<" "<<rs(x)<<" "<<st<<" "<<ed<<" "<<k<<" "<<t[ls(x)].v<<" "<<t[rs(x)].v<<"\n";
    if(t[ls(x)].v>=k) return get(ls(x),st,mid,k);
    else return get(rs(x),mid+1,ed,k-t[ls(x)].v);
}
signed main(){
    freopen("4.in","r",stdin);
    freopen("love.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>m;
    for(int i=1;i<=m;i++){
        int op;
        cin>>op;
        if(op==1){
            double f,b;
            int t;
            cin>>f>>t>>b;
            f+=b/t;
            t=abs(t);
            a[++n]={f,t,i};
            c[n]=i;
            q[i]={op,0,i};
        }
        else{
            int x;
            cin>>x;
            q[i]={op,x,i};
        }
    }
    sort(a+1,a+n+1,cmp);
    for(int i=1;i<=n;i++) d[a[i].id]=i;
    for(int i=1;i<=m;i++){
        int op=q[i].op,x=c[q[i].x],id=q[i].id;
        // cerr<<d[i]<<"!\n";
        // if(i==10||i==12) cerr<<op<<" "<<x<<" "<<id<<"\n";
        if(x==0) update(1,1,n,d[i],a[d[i]].t);
        else update(1,1,n,d[x],-a[d[x]].t);
        int res=query(1,1,n,1,n).v;
        int p=get(1,1,n,res/2+(res&1));
        // cerr<<p<<"!!\n";
        tree l=query(1,1,n,1,p);
        tree r=query(1,1,n,p,n);
        // cout<<p<<" "<<l.v*a[p].f-l.dis<<" "<<r.dis-r.v*a[p].f<<" "<<r.v<<" "<<a[p].f<<" "<<r.dis<<"\n";
        double ans=a[p].f*(l.v-r.v)-l.dis+r.dis;
        printf("%.10lf\n",ans);
    }
}